package cn.com.mall.product.web.controller;

import cn.com.mall.product.web.service.IRedisLockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RedisLockController {

    @Autowired
    IRedisLockService redisLockService;
    @Value("${server.port}")
    String serverPort;


    @GetMapping("/getData")
    public String getData() throws InterruptedException {


        return serverPort+":"+redisLockService.getData();


    }

    @GetMapping("/testRedissonLock")
    public String testRedissonLock() throws InterruptedException {

        return serverPort+":"+redisLockService.testRedissonLock();


    }

    @GetMapping("/lockDoor")
    public String lockDoor() throws InterruptedException {

        return serverPort+":"+redisLockService.lockDoor();


    }

    @GetMapping("/gogogo")
    public String gogogo() {

        return serverPort+":"+redisLockService.gogogo();
    }

    @GetMapping("/park")
    public String park() throws InterruptedException {

        return serverPort+":"+redisLockService.park();
    }

    @GetMapping("/go")
    public String go() {

        return serverPort+":"+redisLockService.go();
    }




}
